<script language="javascript">
    // apply filters  
   jQuery(document).ready(function(){
        jQuery("#list_etapas").jqGrid({
        	url: '<?php echo site_url() ?>/vtcompania/data/',
            mtype: 'POST',
            datatype: 'json',
            colNames:['ID','Referencia', 'Tipo', 'Fecha R.','Dias','Usuario'],
            colModel :[
                {name:'IdCompania', index:'IdCompania', width:5,hidden:true},
                {name:'NombreCompania', index:'NombreCompania', width:60},
                {name:'tipo', index:'IdServicio', width:35},
                {name:'fecha', index:'FechaUsrCompania', width:60},
                {name:'dias', index:'FechaUsrCompania', width:30},
            	{name:'usuario', index:'IdUsuario', width:30}],
            	
            pager: jQuery('#pager_etapas'),
            hiddengrid: false,
            sortname: 'IdCompania',
            rowNum:30,
            rowList:[40,50,60,70,80],
            sortorder: 'DESC',
            height: '100%',
            width: '690',
            imgpath: _base_url + 'public/css/jqgrid/flex/images',
            viewrecords: true,
            multiselect: false,
            editurl:"http://localhost/company24h/index.php/etapastrx/save",
            onSelectRow: function(ids) 
            {
            	if(ids != null) 
            	{
            		var rec = jQuery("#list_etapas").getRowData(ids);
        		    lol=ids;
            	}
            },
            adjacents: 4,
            
        jsonReader: {repeatitems : false, IdCompania: "0" }
        }).navGrid('#pager_etapas', {add:false,edit:false,del:false,search:false}, //options
     
        {height:280,reloadAfterSubmit:true}, // edit options 
        {height:280,reloadAfterSubmit:false}, // add options 
        {reloadAfterSubmit:false}, // del options 
        {})// search options 
        
        .navButtonAdd('#pager_etapas',{caption:"", buttonimg: _base_url + "public/css/jqgrid/flex/images/text_columns.png", onClickButton:
        function()
        {
             
         jQuery("#list_etapas").setColumns();
         
        }})
        }); 

       

	 var flAuto = true;
	 var timeoutHnd; 

	 function doSearch(ev)
	 { 
	       if(!flAuto) return; 
	       // var elem = ev.target||ev.srcElement; 
	       if(timeoutHnd) 
	           clearTimeout(timeoutHnd); 
	           timeoutHnd = setTimeout(gridReload,500); 
	 }
	  
	 function enableAutosubmit(state)
	 { 
	       flAuto = state; 
	       jQuery("#submitButton").attr("disabled",state); 
	 }
	 
    function gridReload()
	{ 
		     
	          var et_mask = jQuery("#search_et").val();
	          var color_mask = jQuery("#search_color").val();
	          var array_search = color_mask+'-'+et_mask;
	          
	          jQuery("#list_etapas").setGridParam({url :'<?=site_url() ?>/gproduccion/dataCategoria/'+array_search, page : 1}).trigger('reloadGrid'); 
	 }
	 
</script>
<div class="table_container">
<table>
<tr><td><div id="titulo">Listado de las Compa&ntilde;ias para Venta<hr/></div><br /></td></tr>
<tr>
<td>
    <table id="list_etapas" class="scroll"></table>
    <div id="pager_etapas" class="scroll" style="text-align:center;"></div>
</td>
 </tr>
 </table>
</div>